<?php
namespace app\common\process;

class Automatic extends Base {
    protected $model = null;
    protected $validate = null;
    
	public function __construct($model = null, $validate = null, $options = []) {
        parent::__construct();
        $model = $model ? $model : $this->model;
        $validate = $validate ? $validate : $this->validate;
        if($model) {
            if(is_string($model)) {
                if(!$validate) {
                    $validate = $model;
                }
                $model = loadModel($model);
            }
            $this->model = $model;
        }
        if($validate) {
            if(is_string($validate)) {
                $validate = loadValidate($validate);
            }
            $this->validate = $validate;
        }
        if(is_array($options)) {
            foreach ($options as $key => $value) {
                $this->$key = $value;
            }
        }
    }
}
